package com.youdianda.controller;


import com.youdianda.dto.AdvposListDTO;
import com.youdianda.dto.PosAllDTO;
import com.youdianda.dto.YddAdvposDTO;
import com.youdianda.dto.YddSelectDTO;
import com.youdianda.entity.YddAdvpos;
import com.youdianda.result.PageResult;
import com.youdianda.result.Result;
import com.youdianda.service.IYddAdvposService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sdy
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/ydd_advpos")
@Slf4j
public class YddAdvposController {

    @Autowired
    private IYddAdvposService iYddAdvposService;

    /**
     * 查询
     * @param id
     * @return
     */
    @GetMapping("/rowInfo")
   public Result<YddAdvpos> Selectpos(Integer id){

        return iYddAdvposService.Selectpos(id);
   }


    /**
     * 修改
     * @param yddAdvpos
     * @return
     */
    @PostMapping("/update")
    public Result update(@RequestBody YddAdvpos yddAdvpos){
            iYddAdvposService.update(yddAdvpos);
        return Result.success();
    }


    /**
     * 广告位列表-分页
     * @return
     */
    @GetMapping("/list")
    public Result<PageResult> listAdvpos(AdvposListDTO advposListDTO){
        return iYddAdvposService.listAdvpos(advposListDTO);
    }
    /**
     * 删除
     * @param id
     * @return
     */
    @GetMapping("/del")
    public Result delete(Integer id){

    iYddAdvposService.delete(id);

    return Result.success();
    }

    /**
     * 新增
     * @param
     * @return
     */
    @PostMapping("/add")
    public Result add(@RequestBody YddSelectDTO dto){


      return iYddAdvposService.add(dto);
    }


    /**
     * 广告列表 全部
     * @param
     * @return
     */
    @GetMapping("/all")
    public  Result getYddAdvPosAll(){

        return iYddAdvposService.getYddAdvPosAll();
    }



}

